--
-- PostgreSQL database dump
--

-- Started on 2011-03-12 19:08:10

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 330 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1517 (class 1259 OID 16396)
-- Dependencies: 6
-- Name: acl_action; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_action (
    action_id integer NOT NULL,
    action_name character varying(255) NOT NULL,
    controller_id integer NOT NULL
);


ALTER TABLE public.acl_action OWNER TO postgres;

--
-- TOC entry 1518 (class 1259 OID 16399)
-- Dependencies: 1517 6
-- Name: acl_action_action_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_action_action_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_action_action_id_seq OWNER TO postgres;

--
-- TOC entry 1850 (class 0 OID 0)
-- Dependencies: 1518
-- Name: acl_action_action_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_action_action_id_seq OWNED BY acl_action.action_id;


--
-- TOC entry 1851 (class 0 OID 0)
-- Dependencies: 1518
-- Name: acl_action_action_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_action_action_id_seq', 1, false);


--
-- TOC entry 1519 (class 1259 OID 16401)
-- Dependencies: 6
-- Name: acl_controller; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_controller (
    controller_id integer NOT NULL,
    controller_name character varying(255) NOT NULL,
    module_id integer NOT NULL
);


ALTER TABLE public.acl_controller OWNER TO postgres;

--
-- TOC entry 1520 (class 1259 OID 16404)
-- Dependencies: 6 1519
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_controller_controller_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_controller_controller_id_seq OWNER TO postgres;

--
-- TOC entry 1852 (class 0 OID 0)
-- Dependencies: 1520
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_controller_controller_id_seq OWNED BY acl_controller.controller_id;


--
-- TOC entry 1853 (class 0 OID 0)
-- Dependencies: 1520
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_controller_controller_id_seq', 1, false);


--
-- TOC entry 1521 (class 1259 OID 16406)
-- Dependencies: 6
-- Name: acl_module; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_module (
    module_id integer NOT NULL,
    module_name character varying(255) NOT NULL
);


ALTER TABLE public.acl_module OWNER TO postgres;

--
-- TOC entry 1522 (class 1259 OID 16409)
-- Dependencies: 6 1521
-- Name: acl_module_module_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_module_module_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_module_module_id_seq OWNER TO postgres;

--
-- TOC entry 1854 (class 0 OID 0)
-- Dependencies: 1522
-- Name: acl_module_module_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_module_module_id_seq OWNED BY acl_module.module_id;


--
-- TOC entry 1855 (class 0 OID 0)
-- Dependencies: 1522
-- Name: acl_module_module_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_module_module_id_seq', 1, false);


--
-- TOC entry 1523 (class 1259 OID 16411)
-- Dependencies: 6
-- Name: acl_permission; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_permission (
    permission_id integer NOT NULL,
    permission_obs character varying(255) NOT NULL,
    role_id integer NOT NULL,
    modulo_id integer NOT NULL,
    controller_id integer NOT NULL,
    action_id integer NOT NULL
);


ALTER TABLE public.acl_permission OWNER TO postgres;

--
-- TOC entry 1524 (class 1259 OID 16414)
-- Dependencies: 1523 6
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_permission_permission_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_permission_permission_id_seq OWNER TO postgres;

--
-- TOC entry 1856 (class 0 OID 0)
-- Dependencies: 1524
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_permission_permission_id_seq OWNED BY acl_permission.permission_id;


--
-- TOC entry 1857 (class 0 OID 0)
-- Dependencies: 1524
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_permission_permission_id_seq', 1, false);


--
-- TOC entry 1525 (class 1259 OID 16416)
-- Dependencies: 6
-- Name: acl_resource; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_resource (
    resource_id integer NOT NULL,
    resource_nome character varying(255) NOT NULL
);


ALTER TABLE public.acl_resource OWNER TO postgres;

--
-- TOC entry 1526 (class 1259 OID 16419)
-- Dependencies: 6 1525
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_resource_resource_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_resource_resource_id_seq OWNER TO postgres;

--
-- TOC entry 1858 (class 0 OID 0)
-- Dependencies: 1526
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_resource_resource_id_seq OWNED BY acl_resource.resource_id;


--
-- TOC entry 1859 (class 0 OID 0)
-- Dependencies: 1526
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_resource_resource_id_seq', 1, false);


--
-- TOC entry 1527 (class 1259 OID 16421)
-- Dependencies: 6
-- Name: acl_role; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_role (
    role_id integer NOT NULL,
    role_name character varying(255) NOT NULL
);


ALTER TABLE public.acl_role OWNER TO postgres;

--
-- TOC entry 1528 (class 1259 OID 16424)
-- Dependencies: 1527 6
-- Name: acl_role_role_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_role_role_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_role_role_id_seq OWNER TO postgres;

--
-- TOC entry 1860 (class 0 OID 0)
-- Dependencies: 1528
-- Name: acl_role_role_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_role_role_id_seq OWNED BY acl_role.role_id;


--
-- TOC entry 1861 (class 0 OID 0)
-- Dependencies: 1528
-- Name: acl_role_role_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_role_role_id_seq', 11, true);


--
-- TOC entry 1529 (class 1259 OID 16426)
-- Dependencies: 6
-- Name: acl_user; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_user (
    user_id integer NOT NULL,
    user_name character varying(255) NOT NULL,
    user_password character varying(255) NOT NULL,
    user_dt_inicio date NOT NULL,
    user_ativo boolean NOT NULL,
    role_id integer NOT NULL
);


ALTER TABLE public.acl_user OWNER TO postgres;

--
-- TOC entry 1530 (class 1259 OID 16432)
-- Dependencies: 1529 6
-- Name: acl_user_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE acl_user_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.acl_user_user_id_seq OWNER TO postgres;

--
-- TOC entry 1862 (class 0 OID 0)
-- Dependencies: 1530
-- Name: acl_user_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE acl_user_user_id_seq OWNED BY acl_user.user_id;


--
-- TOC entry 1863 (class 0 OID 0)
-- Dependencies: 1530
-- Name: acl_user_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('acl_user_user_id_seq', 3, true);


--
-- TOC entry 1533 (class 1259 OID 16461)
-- Dependencies: 1820 6
-- Name: categoria; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE categoria (
    categoria_id integer NOT NULL,
    categoria_titulo character varying(255) NOT NULL,
    categoria_descricao character varying(255),
    categoria_ativo boolean DEFAULT true,
    categoria_ordem integer NOT NULL
);


ALTER TABLE public.categoria OWNER TO postgres;

--
-- TOC entry 1532 (class 1259 OID 16459)
-- Dependencies: 6 1533
-- Name: categoria_categoria_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE categoria_categoria_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.categoria_categoria_id_seq OWNER TO postgres;

--
-- TOC entry 1864 (class 0 OID 0)
-- Dependencies: 1532
-- Name: categoria_categoria_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE categoria_categoria_id_seq OWNED BY categoria.categoria_id;


--
-- TOC entry 1865 (class 0 OID 0)
-- Dependencies: 1532
-- Name: categoria_categoria_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('categoria_categoria_id_seq', 4, true);


--
-- TOC entry 1531 (class 1259 OID 16434)
-- Dependencies: 1620 6
-- Name: view_login; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW view_login AS
    SELECT au.user_name AS username, au.user_password AS password, ar.role_name AS role FROM (acl_user au JOIN acl_role ar ON ((ar.role_id = au.role_id)));


ALTER TABLE public.view_login OWNER TO postgres;

--
-- TOC entry 1812 (class 2604 OID 16438)
-- Dependencies: 1518 1517
-- Name: action_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_action ALTER COLUMN action_id SET DEFAULT nextval('acl_action_action_id_seq'::regclass);


--
-- TOC entry 1813 (class 2604 OID 16439)
-- Dependencies: 1520 1519
-- Name: controller_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_controller ALTER COLUMN controller_id SET DEFAULT nextval('acl_controller_controller_id_seq'::regclass);


--
-- TOC entry 1814 (class 2604 OID 16440)
-- Dependencies: 1522 1521
-- Name: module_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_module ALTER COLUMN module_id SET DEFAULT nextval('acl_module_module_id_seq'::regclass);


--
-- TOC entry 1815 (class 2604 OID 16441)
-- Dependencies: 1524 1523
-- Name: permission_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_permission ALTER COLUMN permission_id SET DEFAULT nextval('acl_permission_permission_id_seq'::regclass);


--
-- TOC entry 1816 (class 2604 OID 16442)
-- Dependencies: 1526 1525
-- Name: resource_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_resource ALTER COLUMN resource_id SET DEFAULT nextval('acl_resource_resource_id_seq'::regclass);


--
-- TOC entry 1817 (class 2604 OID 16443)
-- Dependencies: 1528 1527
-- Name: role_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_role ALTER COLUMN role_id SET DEFAULT nextval('acl_role_role_id_seq'::regclass);


--
-- TOC entry 1818 (class 2604 OID 16444)
-- Dependencies: 1530 1529
-- Name: user_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE acl_user ALTER COLUMN user_id SET DEFAULT nextval('acl_user_user_id_seq'::regclass);


--
-- TOC entry 1819 (class 2604 OID 16464)
-- Dependencies: 1533 1532 1533
-- Name: categoria_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE categoria ALTER COLUMN categoria_id SET DEFAULT nextval('categoria_categoria_id_seq'::regclass);


--
-- TOC entry 1837 (class 0 OID 16396)
-- Dependencies: 1517
-- Data for Name: acl_action; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1838 (class 0 OID 16401)
-- Dependencies: 1519
-- Data for Name: acl_controller; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1839 (class 0 OID 16406)
-- Dependencies: 1521
-- Data for Name: acl_module; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1840 (class 0 OID 16411)
-- Dependencies: 1523
-- Data for Name: acl_permission; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1841 (class 0 OID 16416)
-- Dependencies: 1525
-- Data for Name: acl_resource; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1842 (class 0 OID 16421)
-- Dependencies: 1527
-- Data for Name: acl_role; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO acl_role (role_id, role_name) VALUES (1, 'admins');
INSERT INTO acl_role (role_id, role_name) VALUES (2, 'users');
INSERT INTO acl_role (role_id, role_name) VALUES (3, 'Testes');
INSERT INTO acl_role (role_id, role_name) VALUES (4, 'Testesssss');
INSERT INTO acl_role (role_id, role_name) VALUES (5, 'Testesssss');
INSERT INTO acl_role (role_id, role_name) VALUES (6, 'Jucas');
INSERT INTO acl_role (role_id, role_name) VALUES (7, 'Jucas');
INSERT INTO acl_role (role_id, role_name) VALUES (8, 'Jucas');
INSERT INTO acl_role (role_id, role_name) VALUES (9, 'Jucas');
INSERT INTO acl_role (role_id, role_name) VALUES (10, 'Jucas');
INSERT INTO acl_role (role_id, role_name) VALUES (11, 'Jucas');


--
-- TOC entry 1843 (class 0 OID 16426)
-- Dependencies: 1529
-- Data for Name: acl_user; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO acl_user (user_id, user_name, user_password, user_dt_inicio, user_ativo, role_id) VALUES (1, 'bob', 'e10adc3949ba59abbe56e057f20f883e', '2011-02-16', true, 1);
INSERT INTO acl_user (user_id, user_name, user_password, user_dt_inicio, user_ativo, role_id) VALUES (3, 'jucas', 'e10adc3949ba59abbe56e057f20f883e', '2011-02-28', true, 1);
INSERT INTO acl_user (user_id, user_name, user_password, user_dt_inicio, user_ativo, role_id) VALUES (2, 'rob', 'e10adc3949ba59abbe56e057f20f883e', '2011-02-16', true, 2);


--
-- TOC entry 1844 (class 0 OID 16461)
-- Dependencies: 1533
-- Data for Name: categoria; Type: TABLE DATA; Schema: public; Owner: postgres
--

INSERT INTO categoria (categoria_id, categoria_titulo, categoria_descricao, categoria_ativo, categoria_ordem) VALUES (4, 'Teste', 'Testes', true, 3);


--
-- TOC entry 1822 (class 2606 OID 16446)
-- Dependencies: 1517 1517
-- Name: action_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_action
    ADD CONSTRAINT action_id PRIMARY KEY (action_id);


--
-- TOC entry 1836 (class 2606 OID 16470)
-- Dependencies: 1533 1533
-- Name: categoria_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY categoria
    ADD CONSTRAINT categoria_id PRIMARY KEY (categoria_id);


--
-- TOC entry 1824 (class 2606 OID 16448)
-- Dependencies: 1519 1519
-- Name: controller_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_controller
    ADD CONSTRAINT controller_id PRIMARY KEY (controller_id);


--
-- TOC entry 1826 (class 2606 OID 16450)
-- Dependencies: 1521 1521
-- Name: module_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_module
    ADD CONSTRAINT module_id PRIMARY KEY (module_id);


--
-- TOC entry 1828 (class 2606 OID 16452)
-- Dependencies: 1523 1523
-- Name: permission_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT permission_id PRIMARY KEY (permission_id);


--
-- TOC entry 1830 (class 2606 OID 16454)
-- Dependencies: 1525 1525
-- Name: resource_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_resource
    ADD CONSTRAINT resource_id PRIMARY KEY (resource_id);


--
-- TOC entry 1832 (class 2606 OID 16456)
-- Dependencies: 1527 1527
-- Name: role_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_role
    ADD CONSTRAINT role_id PRIMARY KEY (role_id);


--
-- TOC entry 1834 (class 2606 OID 16458)
-- Dependencies: 1529 1529
-- Name: user_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_user
    ADD CONSTRAINT user_id PRIMARY KEY (user_id);


--
-- TOC entry 1849 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-03-12 19:08:12

--
-- PostgreSQL database dump complete
--

